home *** CD-ROM | disk | FTP | other *** search
- #ifndef _FDMPROTO_H_
- #define _FDMPROTO_H_
-
- /*
- * There are two ways to directly support Freedom┐ and both methods
- * interpret calls to the fs_iinpath memory area by fsel_[ex]input and
- * additionally pass a structure to the path.
- * This procedure is simple to imagine: Reserve 128 bytes for the path
- * now it's 128+sizeof(Fdm_Str).
- * In this memory (you don't have to concern yourself with global
- * legibility under MiNT) the following structure will be copied,
- * directly after the path string. The path will also be moved after
- * the sizeof(Fdm_Str). You can now follow two different paths:
- *
- * 1) Simply pass a pointer to this memory area in fs_iinpath.
- * Through the Magic at the start Freedom┐ immediately recognises the
- * caller supports the protocol. This method has the disadvantage that
- * in the unlikely case that Freedom┐ isn't installed you can't use
- * it! You must also check in the Cookie jar to see if a FSEL-Cookie
- * >= v2.0 is available (refer to SLECTRIC.H)
- *
- * 2) Pass a pointer to the path behind the structure. This is
- * understood by other file selectors so you don't need to check the
- * Cookie to see if Freedom┐ is installed. Freedom┐ can now simply
- * check sizeof(Fdm_Str), from the pointer passed, to see if the Magic
- * is present by chance, so long as MiNT with active memory protection
- * isn't active. Using this method Freedom┐ can still reply that it's
- * harmless to access memory before the path:
- * If Freedom┐ finds the four characters '?Fdm' after the null byte of
- * the path (the same Magic as the structure expected), then it looks
- * at the following path to find the structure. And now (finally),
- * the structure:
- */
- typedef struct
- {
- long magic; /* '?Fdm' */
- int id; /* any Id */
- int maxsel; /* maximum number of selected files */
- struct
- {
- unsigned fullpaths : 1; /* full pathnames in the reply */
- unsigned doquote : 1; /* Freedom┐ may quote */
- unsigned noname : 1; /* no application names before title */
- unsigned sysmodal : 1; /* System modal open */
- unsigned resvd : 28; /* reserved (set to 0) */
-
- } flags;
- int handle; /* After success contains the file selector's window
- handle (or 0 if a flying dialog).
- Use: the calling program can then control the file
- selector, perhaps it sends Freedom┐ a WM_CLOSED
- message, or adds it to its stack of windows for
- window-cycling.
- */
- int server; /* After success contains the application ID of the file
- selector server. From it messages could also be
- sent at the same time to the window's handle.
- */
- char path[0]; /* The old file selector path starts here... */
-
- } Fdm_Str;
-
- If fsel_input returns 'magic' then '!Fdm' is returned otherwise the call
- is forwarded to the OS, and the returned values (fs_iinpath, fs_iinsel,
- fs_iexbutton) are valid!
-
- If the call is successful an AES message is passed to the application.
- Whether the application continues to run or waits in a sub-event loop for
- the reply (in which case you process only WM_REDRAW and Co) is entirely up
- to you although naturally it's better to continue running whenever
- possible.
-
- The format of the AES reply message is:
-
- #define FILE_SELECTED 0x4560
- /* FILE_SELECTED: A file selector was closed:
- * Word 3: ID of the file selectors (as given by fsel_[ex]input)
- * Word 4/5: Pointer to the path and extension at the time of closing
- * Word 6/7: Pointer to the selected files, or NULL, if the user has
- * cancelled the operation
- * The files are separated using spaces and use single quotes to
- * preserve spaces inside filenames, for example:
- * 'Chrisker''s paperweight'
- */
- #ifndef FILE_SELECTED
- #define FILE_SELECTED 0x4560
- #endif
- /*
- * On receipt of this message the program can, for the following ten
- * seconds, safely access the (MiNT-global) memory, at the words 3/4
- * ie 6/7, and copy the data. Afterwards Freedom┐ releases the memory
- * again to GEMDOS (Mfree)!
- *
- *
- * Should a message be sent to the Server the following messages
- * should be used instead of the standard screen manager messages
- * WM_TOPPED and WM_CLOSED. Normal messages passed may well be
- * unexpected. For instance the file selector may be ICFS Iconified if
- * a [Shift] key is held down (WM_CLOSED), or the object under the
- * mouse is served instead because Freedom┐ simulates background
- * operation (WM_TOPPED) under SingleTOS.
- */
- #ifndef WIN_TOPPED
- #define WIN_TOPPED 0x7a22
- #endif
- #ifndef WIN_CLOSED
- #define WIN_CLOSED 0x7a23
- #endif
-
- #endif /* _FDMPROTO_H_ */
-